#ifndef LOGGERRECORD_HEADER_VIZMF_PROJECT
#define LOGGERRECORD_HEADER_VIZMF_PROJECT

#include <string>
#include "src/core/generic/datetime.h"

class LoggerRecord
{
public:
  typedef DateTime TimestampType;
  typedef std::string string_type;
  enum Record {NewDocument, DocumentSaved, DocumentClosed, FileOpened, FileOpenError, FileParsingErrorFiletype, FileParsingUnknownFiletype, ParsingBadAtomIndex, ParsingBadAtomEntry, ParsingBadBondIndex, NoCorrespondingAtom, ParsingAtomPropertiesError, ParsingAtomPropertiesUnknownTagError, ParsingAtomPropertiesNoStyleNameError, ParsingAtomPropertiesUnknownPrimitiveError, ParsingAtomPropertiesBadAtomZ, ParsingAtomPropertiesBadParameterQuantity, ParsingAtomPropertiesBadColorValue};
  enum RecordType {Normal, Warning, Error};
  enum RecordPriority {Critical = 4, High = 3, Norm = 2, Low = 1, User = 10, Unknown = 0};
  LoggerRecord(const int id, const Record record, const string_type& params = string_type(), const TimestampType& time = TimestampType::currentDateTime()) : _params (params), _wspId(id), _record (record), _time(time) {}
  RecordType type() const
  {
    switch ( _record )
    {
    case NewDocument:
    case DocumentSaved:
    case DocumentClosed:
    case FileOpened:
      return Normal;
    case FileOpenError:
    case FileParsingErrorFiletype:
    case ParsingAtomPropertiesError:
      return Error;
    case FileParsingUnknownFiletype:
    case ParsingBadAtomIndex:
    case ParsingBadAtomEntry:
    case ParsingBadBondIndex:
    case NoCorrespondingAtom:
    case ParsingAtomPropertiesUnknownTagError:
    case ParsingAtomPropertiesNoStyleNameError:
    case ParsingAtomPropertiesUnknownPrimitiveError:
    case ParsingAtomPropertiesBadAtomZ:
    case ParsingAtomPropertiesBadParameterQuantity:
    case ParsingAtomPropertiesBadColorValue:
      return Warning;
    default:
      return Normal;
    }
  }
  TimestampType time() const { return _time; }
  RecordPriority priority() const
  {
    switch ( _record )
    {
    case FileOpenError:
    case FileParsingErrorFiletype:
      return High;
    case FileParsingUnknownFiletype:
    case ParsingBadAtomIndex:
    case ParsingBadAtomEntry:
    case ParsingBadBondIndex:
    case NoCorrespondingAtom:
    case ParsingAtomPropertiesError:
      return Norm;
    case NewDocument:
    case DocumentSaved:
    case DocumentClosed:
    case FileOpened:
    case ParsingAtomPropertiesUnknownTagError:
    case ParsingAtomPropertiesNoStyleNameError:
    case ParsingAtomPropertiesUnknownPrimitiveError:
    case ParsingAtomPropertiesBadAtomZ:
    case ParsingAtomPropertiesBadParameterQuantity:
    case ParsingAtomPropertiesBadColorValue:
      return Low;
    default:
      return Unknown;
    }
  }
  const string_type& params() const { return _params; }
  int wspId() const { return _wspId; }
  string_type text() const;
private:
  string_type _params;
  int _wspId;
  Record _record;
  TimestampType _time;
};

#endif // LOGGERRECORD_HEADER_VIZMF_PROJECT
